
//获取详情信息
getSkuDetail()
function getSkuDetail() {
    var user_data = {
        skuId: getQueryString('sku_Id')
    }
    var succCallBack = function (data, status, response) {
        var SkuData=data.data
        if(SkuData!="" && SkuData!=null){
            $("#spuCode ").html(SkuData.spuCode )
            $("#skuCode").html(SkuData.skuCode)
            $("#skuName").html(SkuData.skuName)
            $("#packagingLayersNumber").html(SkuData.packagingLayersNumber)
            $("#partsNumber").html(SkuData.partsNumber)
            $("#internationalBarCode").html(SkuData.internationalBarCode)
            var orderLimitType = ""
            if (SkuData.orderLimitType== 0) {
                orderLimitType = '起售量整数倍'
            }else if (SkuData.orderLimitType == 1) {
                orderLimitType = '不低于起售量'
            }
            $("#orderLimitType").html(orderLimitType)
            $("#mainUnitName").html(SkuData.mainUnitName)
            $("#numberDecimal").html(SkuData.numberDecimal)
            $("#ycMiniOrder").html(SkuData.ycMiniOrder)
            $("#miniOrders").html(SkuData.miniOrder)
            //商品尺寸
            var maxLength=""
            if(SkuData.maxLength!=""||SkuData.maxLength!=null){
                maxLength=SkuData.maxLength+'厘米'
            }
            $("#maxLength").html(maxLength)
            var subLength=""
            if(SkuData.subLength!=""||SkuData.subLength!=null){
                subLength=SkuData.subLength+'厘米'
            }
            $("#subLength").html(subLength)
            var minLength=""
            if(SkuData.minLength!=""||SkuData.minLength!=null){
                minLength=SkuData.minLength+'厘米'
            }
            $("#minLength").html(minLength)
            var volume=""
            if(SkuData.volume!=""||SkuData.volume!=null){
                volume=SkuData.volume+'立方米'
            }
            $("#volume").html(volume)
            var weight=""
            if(SkuData.weight!=""||SkuData.weight!=null){
                weight=SkuData.weight+'千克'
            }
            $("#weight").html(weight)
            //销售属性
            $("#skuSaleAttributesdata").html('<th class="col-6-1 text-c">规格属性</th><td><span id="specificationProperties">'+SkuData.specificationProperties+'</span></td>')
            var skuSaleAttributes=SkuData.skuSaleAttributes
            var skuSaleAttributesdata=""
            if(skuSaleAttributes){
                for (var i=0;i<skuSaleAttributes.length;i++){
                    skuSaleAttributesdata+='<tr>\n' +
                        '                            <th class="col-6-1 text-c">'+skuSaleAttributes[i].saleAttributesName+'</th>\n' +
                        '                            <td>'+skuSaleAttributes[i].saleAttributesValue+'</td>\n' +
                        '                        </tr>'
                }
                $("#skuSaleAttributesdata").append(skuSaleAttributesdata)
            }
            //图片信息
            if(SkuData.delicacySkuInfoImgs!=""&&SkuData.delicacySkuInfoImgs!=null){
                var imgs=""
                for (var i=0;i < SkuData.delicacySkuInfoImgs.length; i++){
                    imgs+='<img class="ml-20" width="150" height="150" src='+SkuData.delicacySkuInfoImgs[i].imgUrl+'>';
                }
                $("#SkuImg").html(imgs)
            }
           /* PictureInformation(1)*/

        }

    };
    return web.doAjax(root.goodsInter.goods_getSkuDetail, 'post', user_data, succCallBack);
}
//最小起订量修改
function ModifiedQuantity() {
    //隐藏按钮
    $("#mini_order").css({
        display: "none"
    })
    $("#modify").css({
        display: "none"
    })
    //展示按钮
    $("#miniorder").css({
        display: 'inline-block'
    })
    $("#confirm").css({
        display: 'inline-block'
    })
    $("#cancel").css({
        display: 'inline-block'
    })
    //文本框赋值
    $("#miniorder").val($("#ycMiniOrder").html())
}
//最小起订量确定
function ConfirmQuantity() {
    var user_data = {
        skuId:getQueryString('sku_Id'),
        miniOrder:$("#miniorder").val()
    }
    var succCallBack = function (data, status, response) {
       if(data.code==0){
           layer.msg('修改成功', {icon: 6, time: 1000});
           setTimeout( function () {
               //按钮隐藏
               CancelQuantity()
               //获取详情信息
               getSkuDetail()
           },700);
       }
    };
    return web.doAjax(root.goodsInter.updateMiniOrderBySkuId, 'post', user_data, succCallBack);
}
//最小起订量取消
function CancelQuantity() {
    //隐藏按钮
    $("#miniorder").css({
        display: 'none'
    })
    $("#confirm").css({
        display: 'none'
    })
    $("#cancel").css({
        display: 'none'
    })
    //展示按钮
    $("#mini_order").css({
        display: 'inline-block'
    })
    $("#modify").css({
        display: 'inline-block'
    })
}
